<div id="home_login_wrapper">
    
    <div id="logo_wrapper">
        <a href="<?php echo site_url(); ?>">
            <img src="<?php echo interface_url('/img/logo.png'); ?>" alt="<?php echo $this->config->item('site_name'); ?>" title="<?php echo $this->config->item('site_name'); ?>" id="vanilladb_logo" />
        </a>
        <h2 id="site_subtitle"><?php echo $this->lang->line('site_subtitle'); ?></h2>
    </div>
    
    {* Display the API login/logout *}
    <?php if($api_can_connect) : ?>
    <div id="api_connect_wrapper">
            <?php if($api_logged_in === false) : ?>
                <a href="<?php echo vanilladb_login_url(); ?>" class="oauthpopup btn btn-primary">
                    <?php echo $this->lang->line('database_vanilladb_login'); ?>
                </a>
            <?php else : ?>
                <a href="<?php echo vanilladb_logout_url(); ?>" class="btn">
                    <?php echo $this->lang->line('database_api_disconnect'); ?>
                </a>
            <?php endif; ?>
    </div>
    <?php endif; ?>
    
    {* Display the form tabs *}
    <?php if(count($form) > 1) : ?>
        <ul id="form_login_select">
            <?php foreach($form as $form_name => $form_data) : ?>
                <li id="<?php echo $form_name; ?>_select"><?php echo $form_name; ?></li>
            <?php endforeach; ?>
        </ul>
    <?php endif; ?>
    
    {* Display the form *}
    <?php if(count($form) > 0) : ?>
        <?php echo output_form(array('end' => false, 'show_required' => false)); ?>
        <?php foreach($form as $form_name => $form_data) : ?>
            <div id="<?php echo $form_name; ?>_form" class="form_wrapper">
                <?php echo output_form(array('start' => false, 'end' => false, 'fields' => $form_data)); ?>
            </div>
        <?php endforeach; ?>
        <?php echo output_form(array('start' => false, 'show_required' => false)); ?>
    <?php endif; ?>
    
</div>